package com.yunxi.service.localService.dealer.impl;

import com.github.pagehelper.PageInfo;
import com.yunxi.core.page.PageHelperPlus;
import com.yunxi.core.service.ServiceImplPlus;
import com.yunxi.core.util.BeanTools;
import com.yunxi.core.web.LoginInfo;
import com.yunxi.dao.dealer.PartnerAccountMapper;
import com.yunxi.dealer.pojo.PartnerAccountOneVO;
import com.yunxi.dealer.pojo.PartnerAccountVO;
import com.yunxi.model.dealer.PartnerAccount;
import com.yunxi.service.localService.dealer.PartnerAccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 渠道商帐户 服务实现类
 * </p>
 *
 * @author
 * @since 2019-05-16
 */
@Service
public class PartnerAccountServiceImpl extends ServiceImplPlus<PartnerAccountMapper, PartnerAccount> implements PartnerAccountService {

   @Autowired
   PartnerAccountMapper partnerAccountMapper;

   @Override
   public List load(String partnerCode, String datam, String datbi) {

      return partnerAccountMapper.load(partnerCode);
   }

   @Override
   public List<PartnerAccountOneVO> listByGroup(PartnerAccountVO partnerAccountVO, LoginInfo loginInfo) {
      return partnerAccountMapper.listByGroup(partnerAccountVO);
   }

   @Override
   public PageInfo pageByGroup(PartnerAccountVO partnerAccountVO, Integer pageNum, Integer pageSize, LoginInfo loginInfo) {
      Map map = BeanTools.bean2map(partnerAccountVO);
      PageHelperPlus.startPage(pageNum,pageSize);
      List<PartnerAccountOneVO> list = baseMapper.listByGroup(partnerAccountVO);
      PageInfo<PartnerAccountOneVO> pageInfo = new PageInfo<PartnerAccountOneVO>(list);
      return pageInfo;
   }

   @Override
   public void updateBatch(List<PartnerAccountVO> partnerAccountVOList) {
      partnerAccountMapper.updateBatch(partnerAccountVOList);
   }
}
